﻿using System;
using System.Reactive.Threading.Tasks;
using System.Threading.Tasks;
using Cureos.Measures;

namespace SensorDrone.Net
{
    /// <summary>
    /// Interface to a sensordrone sensor
    /// </summary>
    public interface ISensor
    {
        /// <summary>
        /// Indicates the sensor provides SI measurements
        /// </summary>
        bool IsSi { get; }
        /// <summary>
        /// The name of the sensor e.g. "Ambient,Pressure,IR,Altitude,Lux,RGBC,Humidity"
        /// </summary>
        string Name { get; set; }
        /// <summary>
        /// The measurement unit indicator
        /// </summary>
        string Unit { get; set; }
        /// <summary>
        /// A function to enable the sensor
        /// </summary>
        Func<IDroneChannel, bool> Enable { get; set; }
        /// <summary>
        /// A function to disable the sensor
        /// </summary>
        Func<IDroneChannel, bool> Disable { get; set; }
        /// <summary>
        /// A function to read a sensor
        /// </summary>
        Func<IDroneChannel, string> Measure { get; set; }
        /// <summary>
        /// A function to determine the status of the sensor
        /// </summary>
        Func<IDroneChannel, bool> Status { get; set; }
        /// <summary>
        /// A function to convert a measurement to a reading
        /// </summary>
        /// <param name="reading">The measurement as a string</param>
        /// <returns>A reading</returns>
        Reading CreateReading(string reading);
    }
}